<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="./css/style.css">
    <script src="../jquery-3.4.1.js"></script>
</head>

<body>
    <div class="box">
        <ul class="box-list">
        </ul>
    </div>
</body>
<script>
    window.onload = () => {
        let ul = document.querySelector(".box-list");
        // let lists = document.querySelectorAll('.item');

        let renderUI = data => {
            let lists = data.map(item => {
                return `<li class="item">
                            <div class="item-box">
                                <img src=${item.src}>
                                <div class="price ">￥${item.price}</div>
                                <div class="title ">${item.title}</div>
                                <div class="dis">${item.disCount}</div>
                                <div class="storeName ">${item.shopName}</div>
                            </div>
                        </li>`
            }).join('');
            ul.innerHTML = lists;
        }
        $.ajax({
        type: "get",
        url: "../server/sndata.json",
        dataType: "json",
        success: function (data) {
            console.log(data);
            renderUI(data);
        }
    });
    }
   
</script>

</html>